| Filename | (eval 1230)[/usr/share/perl5/CGI/Compile.pm:12] |
| Statements | Executed 15 statements in 512µs |
| Eval Invoked At | /usr/share/perl5/CGI/Compile.pm line 12 |
| Sibling evals | 1, 2 |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 37µs | 63µs | CGI::Compile::ROOT::home_vagrant_kohaclone_mainpage_2epl::BEGIN@2 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | 1 | 700ns | package CGI::Compile::ROOT::home_vagrant_kohaclone_mainpage_2epl;sub {local $CGI::Compile::USE_REAL_EXIT = 0; | ||
| 2 | 14 | 511µs | 5 | 170µs | # spent 63µs (37+26) within CGI::Compile::ROOT::home_vagrant_kohaclone_mainpage_2epl::BEGIN@2 which was called:
# once (37µs+26µs) by CGI::Compile::_eval at line 2 # spent 63µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_mainpage_2epl::BEGIN@2
# spent 53µs making 1 call to File::pushd::pushd
# spent 26µs making 1 call to warnings::unimport
# spent 18µs making 1 call to CGI::initialize_globals
# spent 10µs making 1 call to CGI::Compile::ROOT::home_vagrant_kohaclone_mainpage_2epl::CORE:open |
| 3 | #line 1 /home/vagrant/kohaclone/mainpage.pl | ||||
| 4 | #!/usr/bin/perl | ||||
| 5 | |||||
| 6 | # This file is part of Koha. | ||||
| 7 | # | ||||
| 8 | # Copyright Paul Poulain 2002 | ||||
| 9 | # Parts Copyright Liblime 2007 | ||||
| 10 | # Copyright (C) 2013 Mark Tompsett | ||||
| 11 | # | ||||
| 12 | # Koha is free software; you can redistribute it and/or modify it | ||||
| 13 | # under the terms of the GNU General Public License as published by | ||||
| 14 | # the Free Software Foundation; either version 3 of the License, or | ||||
| 15 | # (at your option) any later version. | ||||
| 16 | # | ||||
| 17 | # Koha is distributed in the hope that it will be useful, but | ||||
| 18 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| 20 | # GNU General Public License for more details. | ||||
| 21 | # | ||||
| 22 | # You should have received a copy of the GNU General Public License | ||||
| 23 | # along with Koha; if not, see <http://www.gnu.org/licenses>. | ||||
| 24 | |||||
| 25 | use Modern::Perl; | ||||
| 26 | use CGI qw ( -utf8 ); | ||||
| 27 | use C4::Output; | ||||
| 28 | use C4::Auth; | ||||
| 29 | use C4::Koha; | ||||
| 30 | use C4::NewsChannels; # GetNewsToDisplay | ||||
| 31 | use C4::Review qw/numberofreviews/; | ||||
| 32 | use C4::Suggestions qw/CountSuggestion/; | ||||
| 33 | use C4::Tags qw/get_count_by_tag_status/; | ||||
| 34 | use Koha::Borrower::Modifications; | ||||
| 35 | use Koha::Borrower::Discharge; | ||||
| 36 | |||||
| 37 | my $query = new CGI; | ||||
| 38 | |||||
| 39 | my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( | ||||
| 40 | { | ||||
| 41 | template_name => "intranet-main.tt", | ||||
| 42 | query => $query, | ||||
| 43 | type => "intranet", | ||||
| 44 | authnotrequired => 0, | ||||
| 45 | flagsrequired => { catalogue => 1, }, | ||||
| 46 | } | ||||
| 47 | ); | ||||
| 48 | |||||
| 49 | my $homebranch; | ||||
| 50 | if (C4::Context->userenv) { | ||||
| 51 | $homebranch = C4::Context->userenv->{'branch'}; | ||||
| 52 | } | ||||
| 53 | my $all_koha_news = &GetNewsToDisplay("koha",$homebranch); | ||||
| 54 | my $koha_news_count = scalar @$all_koha_news; | ||||
| 55 | |||||
| 56 | $template->param( | ||||
| 57 | koha_news => $all_koha_news, | ||||
| 58 | koha_news_count => $koha_news_count | ||||
| 59 | ); | ||||
| 60 | |||||
| 61 | my $branch = | ||||
| 62 | ( C4::Context->preference("IndependentBranchesPatronModifications") | ||||
| 63 | || C4::Context->preference("IndependentBranches") ) | ||||
| 64 | && !$flags->{'superlibrarian'} | ||||
| 65 | ? C4::Context->userenv()->{'branch'} | ||||
| 66 | : undef; | ||||
| 67 | |||||
| 68 | my $pendingcomments = numberofreviews(0); | ||||
| 69 | my $pendingtags = get_count_by_tag_status(0); | ||||
| 70 | my $pendingsuggestions = CountSuggestion("ASKED"); | ||||
| 71 | my $pending_borrower_modifications = | ||||
| 72 | Koha::Borrower::Modifications->GetPendingModificationsCount( $branch ); | ||||
| 73 | my $pending_discharge_requests = Koha::Borrower::Discharge::count({ pending => 1 }); | ||||
| 74 | |||||
| 75 | $template->param( | ||||
| 76 | pendingcomments => $pendingcomments, | ||||
| 77 | pendingtags => $pendingtags, | ||||
| 78 | pendingsuggestions => $pendingsuggestions, | ||||
| 79 | pending_borrower_modifications => $pending_borrower_modifications, | ||||
| 80 | pending_discharge_requests => $pending_discharge_requests, | ||||
| 81 | ); | ||||
| 82 | |||||
| 83 | # | ||||
| 84 | # warn user if he is using mysql/admin login | ||||
| 85 | # | ||||
| 86 | unless ($loggedinuser) { | ||||
| 87 | $template->param(adminWarning => 1); | ||||
| 88 | } | ||||
| 89 | |||||
| 90 | output_html_with_http_headers $query, $cookie, $template->output; | ||||
| 91 | |||||
| 92 | }; | ||||
| 93 | my $self = shift; | ||||
| 94 | my $exit_val = unpack('C', pack('C', sprintf('%.0f', $rv))); | ||||
| 95 | if ($@) { | ||||
| 96 | die $@ unless ( | ||||
| 97 | ref($@) eq 'ARRAY' and | ||||
| 98 | $@->[0] eq "EXIT\n" | ||||
| 99 | ); | ||||
| 100 | my $exit_param = unpack('C', pack('C', sprintf('%.0f', $@->[1]))); | ||||
| 101 | |||||
| 102 | if ($exit_param != 0 && !$CGI::Compile::RETURN_EXIT_VAL && !$self->{return_exit_val}) { | ||||
| 103 | die "exited nonzero: $exit_param"; | ||||
| 104 | } | ||||
| 105 | |||||
| 106 | $exit_val = $exit_param; | ||||
| 107 | } | ||||
| 108 | |||||
| 109 | return $exit_val; | ||||
| 110 | }; | ||||
| 111 | ; |